package base.io;

import java.io.*;

public class InputAndOutputStreamTest001 {
  private static String COMMON_PATH = "E:%stest%s";
  
  public static void main(String[] args) throws IOException {
    File inputFile = new File(String.format(COMMON_PATH + "111.input.jpg", File.separator, File.separator));
    File outputFile = new File(String.format(COMMON_PATH + "111.output.jpg", File.separator, File.separator));
    
    if (outputFile.exists())
      outputFile.delete();
    
    FileInputStream fileInputStream = new FileInputStream(inputFile);
    FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
    
    int readLength;
    byte[] bytes = new byte[1024 * 10];
    while ((readLength = fileInputStream.read(bytes)) != -1) {
      fileOutputStream.write(bytes, 0, readLength);
    }
    
    fileInputStream.close();
    fileOutputStream.close();
    
    System.out.println("复制完成 ......");
  }
}
